<include file="Public:header" />
<div class="container no-mar-top no-bg" >
	<div class="row ">
		<div class="span2 bs-docs-sidebar mar-left3" >
			<ul class="nav nav-list bs-docs-sidenav span2 widths" id="left_list" style="height:440px;">
				<li class="first-li"><span class="spans1" ><img src="__PUBLIC__/img/house.png"/>&nbsp;任务详情</span></li>
				<li class="active"><a href="#tab1">{:L('BASIC_INFO')}</a></li>
				<li><a href="#tab2">{:L('PROGRESS_LOG')}&nbsp;&nbsp;<span class="badge badge-success"><if condition="$task['log_count']">{$task['log_count']}</if></span></a></li>
			</ul>
		</div>
		<div class="tab-content span8 mar-lefts" >
			<div class="tab-pane fade in active" id="tab1">
				<div class="container2 top-pad" >
					<spanclass="basic_information" name="tab">{:L('TASK_VIEW')}</span>
					<div class="pull-right"style="margin:-3px 10px 0 0;">
						<a href="{:U('task/edit','id='.$task['task_id'])}" class="btn btn-primary"/>{:L('EDIT')}</a>
						<a href="{:U('task/delete','redirect=1&id='.$task['task_id'])}" class="btn btn-primary del_confirm"/>{:L('DELETE')}</a>
						<a href="javascript:void(0)" onclick="javascript:history.go(-1)" class="btn btn-primary">{:L('RETURN')}</a>
					</div>
				</div>
				<div class="back_box" style="margin-top:10px;">
					<include file="Public:alert"/>
					<table class="table">
						<tbody>
							<tr>
								<td class="tdleft" width="15%">{:L('THEME')}：</td>
								<td width="35%">{$task.subject}</td>
								<td <if condition="C('ismobile') neq 1">width="15%"</if> class="tdleft" >{:L('EXPIRATION_DATE')}：</td>
								<td <if condition="C('ismobile') neq 1">width="35%"</if>><if condition="$task['due_date'] gt 0">{$task.due_date|date='Y-m-d H:i',###}</if></td>
							</tr>
							<tr>
								<td class="tdleft"><font style="font-weight:700;">负责人：</span></td>
								<td colspan="7">
									<volist name="task['owner']" id="vo" >
										<notempty name="vo.user_name">
										<a class="role_info" rel="{$vo.role_id}" href="javascript:void(0)">{$vo.user_name}</a>&nbsp;,
										</notempty>
									</volist>
								</td>
							</tr>
							<tr>
								<td class="tdleft"><font style="font-weight:700;">任务相关人列表：</font></td>
								<td colspan="7">
									<volist name="task['about_roles']" id="vo" >
										<notempty name="vo.user_name">
										<a class="role_info" rel="{$vo.role_id}" href="javascript:void(0)">{$vo.user_name}</a>&nbsp;,
										</notempty>
									</volist>
								</td>
							</tr>
							<tr>
								<td class="tdleft" >{:L('STATUS')}：</td>
								<td>{$task.status}</td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft" >{:L('PRECEDENCE')}：</td>
								<td >{$task.priority}</td>								
							</tr>
							<tr>
								<td class="tdleft" >{:L('CREATE_TIME')}：</td>
								<td><if condition="$task['create_date'] gt 0">{$task.create_date|date='Y-m-d H:i:s',###}</if></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft">{:L('CREATOR_ROLE')}：</td>
								<td><notempty name="task.creator.user_name"><a class="role_info" rel="{$task.creator.role_id}" href="javascript:void(0)">{$task.creator.user_name}</a></notempty></td>							
							</tr>
							<tr>
							<notempty name="task.module.module_name">
								<td class="tdleft">{:L('RELATED_THINGS', array($task['module']['module_name']))}</td>
								<td ><a  href="{:U($task['module']['module'].'/view','id='.$task['module']['module_id'])}">{$task.module.name}</a></td>
								<if condition="C('ismobile') eq 1"><td colspan="2">&nbsp;</td></if>
							</tr>
							</notempty>
							<tr>
								<td class="tdleft" >
									{:L('DESCRIPTION')}：
								</td><td <if condition="C('ismobile') neq 1">colspan="3"</if> >
									<if condition="$task.description neq null">{$task.description}</if>
								</td>
							</tr>
							<tr>
								<td class="tdleft">{:L('COMMENT')}:</td>
								<td <if condition="C('ismobile') neq 1">colspan="3"</if>>
									<table width="100%">
										<empty name="comment_list">
											<tr>
												<td colspan="2">{:L('NO_SUPERIORS_COMMENT')}</td>
											</tr>
										<else />
											<volist name="comment_list" id="vo">
												<tr>
													<td colspan="2">{:L('COMMENTATOR')}:<a class="role_info" rel="{$vo.role_id}" href="javascript:void(0)">{$vo.user_name}</a>（{$vo.create_time|date="Y-m-d H:i",###}）<if condition="$vo['role_id'] == session('role_id')">
															<a rel="{$vo['comment_id']}" class="edit_comment_btn" href="javascript:void(0);">{:L('EDIT')}</a>
														</if></td>
												</tr>
												<tr>
													<td colspan="2"><if condition="$vo.content neq ''"><pre>{$vo.content}</pre></if></td>
												</tr>
											</volist>
										</empty>
									</table>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
			<div class="tab-pane fade back_box" id="tab2">
				<div class="header1">
					<div class="pull-left two-title" >{:L('PROGRESS_LOG')}</div>
					<div class="pull-right">
						<if condition="$task['isclose'] eq 0"><p class="pull-right">
							<a href="javascript:void(0);" class="add_log btn btn-primary">+ 添加进度日志</a></p>
						</if>
					</div>
					<div style="clear:both;"></div>
				</div>
				<a name="tab2">&nbsp;</a>
				<volist name="task['log']" id="vo">
					<table class="table table-bordered info">
						<tr class="{$vo['style']}">
							<td class="tdleft" width="12.5%"><font style="font-weight:700;">姓名</font></td>
							<td width="37.5%">{$vo.owner.user_name}</td>
							<td width="12.5%" class="tdleft"><font style="font-weight:700;">时间</font></td>
							<td width="37.5%">{$vo.create_date|date="Y-m-d  H:i",###}</td>
						</tr>
						<tr class="{$vo['style']}">
							<td class="tdleft"><font style="font-weight:700;">相关附件</font></td>
							<td colspan="3">
								<volist name="vo['files']" id="v">
									<a href="{$v['file_path']}" title="{$v.name}">{$v.subName}</a><br>
								</volist>
							</td>
						</tr>
						<tr class="{$vo['style']}">
							<td class="tdleft"><font style="font-weight:700;">新增相关人</font></td>
							<td colspan="3">{$vo.about_roles_name}</td>
						</tr>
						<tr class="{$vo['style']}">
							<td class="tdleft"><font style="font-weight:700;">内容描述</font></td>
							<td colspan="3"><pre>{$vo.content}</pre></td>
						</tr>
						
					</table>
				</volist>
			</div>
		</div>
		<div class="span2 bs-docs-sidebar mar-lefts2" id="right_list" >
			<ul class="nav nav-list bs-docs-sidenav  span2 widths" >
				<li class="active first-li"><span class="spans1">编辑详情</span></li>
				<if condition="session('role_id') eq $task['creator_role_id']">
				<li><a id="comment_btn" href="javascript:void(0);"><img src="__PUBLIC__/img/youce.png"/>&nbsp;&nbsp;&nbsp;{:L('COMMENT')}</a> </li></if>
				<li><a href="javascript:void(0);" class="add_log"><img src="__PUBLIC__/img/youce.png"/>&nbsp;&nbsp;&nbsp;{:L('ADD_PROGRESS_LOG')}</a></li>
			</ul>
		</div>
	</div>
</div>
<div class="hide" id="dialog-file" title="{:L('DIALOG_ADD_ATTACHMENTS')}">loading...</div>
<div class="hide" id="dialog-log" title="{:L('DIALOG_ADD_LOG')}">loading...</div>
<div class="hide" id="dialog-role-info" title="{:L('DIALOG_USER_INFO')}">loading...</div>
<div class="hide" id="dialog-log-edit" title="{:L('DIALOG_EDIT_LOG')}">loading...</div>
<if condition="session('role_id') eq $task['creator_role_id']">
<div class="hide" id="dialog-comment" title="{:L('COMMENT')}">loading...</div>
<div class="hide" id="dialog-editcomment" title="{:L('EDIT_COMMENT')}">loading...</div>
</if>
<script type="text/javascript">
$('#left_list a').click(function (e) {
        e.preventDefault();
        $('#right_list').hide();
        $('#left_list').parent().next().removeClass('span8').addClass('span10');
        $(this).tab('show');
    })
    $('#left_list a:first').on('click', function (e) {
        $('#left_list').parent().next().removeClass('span10').addClass('span8');
        $('#right_list').show();
    })
<if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else/>width=800;</if>

$("#dialog-role-info").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-file").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-log").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 500,
	position: ["center",100]
});
$("#dialog-log-edit").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeight: 400,
	position: ["center",100]
});
$("#dialog-comment").dialog({
    autoOpen: false,
    modal: true,
	width: 600,
	maxHeight: 400,
	position: ["center",100],
	buttons: { 
		"{:L('OK')}": function () {
			$('#comment').submit();
			$(this).dialog("close"); 
		},
		"{:L('CANCEL')}": function () {
			$(this).dialog("close");
		}
	}
});
$("#dialog-editcomment").dialog({
    autoOpen: false,
    modal: true,
	width: 600,
	maxHeight: 400,
	position: ["center",100],
	buttons: { 
		"{:L('OK')}": function () {
			$('#editcomment').submit();
			$(this).dialog("close"); 
		},
		"{:L('CANCEL')}": function () {
			$(this).dialog("close");
		}
	}
});
$(function(){
	$(".add_file").click(function(){
		$('#dialog-file').dialog('open');
		$('#dialog-file').load('{:U("file/add","r=RFileTask&module=task&id=".$task["task_id"])}');
	});
	<if condition="$task['isclose'] eq 0">
	$(".add_log").click(function(){
		$('#dialog-log').dialog('open');
		$('#dialog-log').load('{:U("log/tasklog","r=RLogTask&module=task&id=".$task["task_id"])}');
	});
	</if>
	$(".role_info").click(function(){
		$role_id = $(this).attr('rel');
		$('#dialog-role-info').dialog('open');
		$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
	});
	$(".edit_log").click(function(){
		$log_id = $(this).attr('rel');
		$('#dialog-log-edit').dialog('open');
		$('#dialog-log-edit').load('{:U("log/edit","id=")}'+$log_id);
	});
	
	<if condition="session('role_id') eq $task['creator_role_id']">
	$("#comment_btn").click(function(){
		$('#dialog-comment').dialog('open');
		$('#dialog-comment').load('{:U("comment/add","to_role_id=".$task["owner_role_id"]."&module=task&module_id=".$task["task_id"])}');
	});
	$(".edit_comment_btn").click(function(){
		comment_id = $(this).attr('rel');
		$('#dialog-comment').dialog('open');
		$('#dialog-comment').load('{:U("comment/edit","to_role_id=".$task["owner_role_id"]."&id=")}'+comment_id);
	});
	</if>
	$(".more").click(function(){
		log_id = $(this).attr('rel');
		$('#llog_'+log_id).attr('class','');
		$('#slog_'+log_id).attr('class','hide');
	});
});
</script>
<include file="Public:footer" />